/*
 * @Author: HotSuitor
 * @Date: 2020-02-03 12:13:33
 * @LastEditTime : 2020-02-03 12:27:34
 */
import Vue from "vue"
import Vuex from "./kvuex"

Vue.use(Vuex)

export default Vuex.Store({
  state: {
    count: 0
  },
  mutations: {
    increment(state, n = 1) {
      state.count += n
    }
  },
  getters: {
    score(state) {
      return `共扔：${state.count}`
    }
  },
  actions: {
    incrementAsync({ commit }) {
      setTimeout(() => {
        commit("increment", 2)
      }, 1000)
    }
  }
})
